function assignEngineerInToolBar(){
	if(!getSelections()){
		return false;
	}
	var planIds = getSelections();
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgeForAreaEngineerAssignEngineer",
		data : {
			"planIds" : planIds,
			"type" : "2",
		},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				sendPlan(planIds);
			}else{
				tip(data.msg);
			}
		}
	});
}
function refusePlanInToolBar(){
	if(!getSelections()){
		return false;
	}
    var datas = $("#zyAreaEngineerInspectionPlanList").datagrid("getSelections");
    if(datas.length == 0){
        tip("请选择巡检任务!");
        return false;
    }

    var planIds = getSelections();
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgeForAreaEngineerAssignEngineer",
		data : {
			"planIds" : planIds,
			"type" : "1",
		},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				createwindow("拒绝任务","zyInspectionPlanController.do?goBatchAegRefuseMission&planIds="+planIds,500,300);
			}else{
				tip(data.msg);
			}
		}
	});
	
}
function assginEngineerInCol(id){
	$.ajax({
		url : "zyInspectionPlanController.do?doJudgeForAreaEngineerAssignEngineer",
		data : {
			"planIds" : id
		},
		cache : false,
		dataType : 'json',
		type : 'POST',
		success : function(data){
			if(data.success){
				sendPlan(id);
			}else{
				tip(data.msg);
			}
		}
	});
}
function sendPlan(ids){
	createwindow("分派工程师","zyInspectionPlanController.do?goBatchAreaAssignEngineer&planIds="+ids,500,200);
}
function getSelections(){
	var datas = $("#zyAreaEngineerInspectionPlanList").datagrid("getSelections");
	if(datas.length == 0){
		tip("请选择巡检任务!");
		return false;
	}
	var planIdArr = new Array();
	$.each(datas,function(i,item){
		planIdArr.push(item.id);
	});
	return planIdArr.join(",");
}
function planDetials(filedName,url){
	addOneTab("计划详情",url);
}